﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
///AgentPage 的摘要说明
/// </summary>
public class AgentPage:System.Web.UI.Page
{
    protected MatchIns.Model.TMemberLogin UserInfo;
    protected MatchIns.BLL.PageInfo pi = new MatchIns.BLL.PageInfo();

    protected override void OnInit(EventArgs e)
    {
        if (Session["user"] == null)
            Response.Redirect("../Account/Login.aspx?From="+Request.Url.ToString());
        UserInfo = Session["user"] as MatchIns.Model.TMemberLogin; 
        if(UserInfo.UserTypeId!=(int)MatchIns.UserType.代理人)
            Response.Redirect("../Account/Login.aspx?From=" + Request.Url.ToString());
        base.OnInit(e);
    }

    public void Alert(string msg)
    {
        msg = msg.Replace("'", "\'");
        Localize js = new Localize();
        js.Text = "<script type='text/javascript'>alert('" + msg + "');</script>";
        Page.Form.Controls.Add(js);
    }

    public void Location(string url)
    {
        url = url.Replace("'", "\'");
        Localize js = new Localize();
        js.Text = "<script type='text/javascript'>location.href='" + url + "';</script>";
        Page.Form.Controls.Add(js);
    }

}
